package com.hand.hzero.domain.service.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hand.hzero.domain.entity.Example;
import org.hzero.boot.imported.app.service.IDoImportService;
import org.hzero.boot.imported.infra.validator.annotation.ImportService;

import javax.annotation.Resource;

/**
 * <p>
 *
 * </p>
 *
 * @author hand-wd
 */
// 声明模板编码
@ImportService(templateCode = "TEST_WD_SERVER")
public class ImportServiceImpl implements IDoImportService {
    @Resource
    private ObjectMapper objectMapper;

    @Override
    public Boolean doImport(String data) {
        Example user;
        try {
            user = objectMapper.readValue(data, Example.class);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return true;
    }
}
